<script setup>
import {useCounterStore} from "../stores/useCounterStore.js"
import {storeToRefs} from "pinia"

const counterStore = useCounterStore();

console.log(counterStore)
//第一种用法 直接counterStore.count 获取属性  counterStore.add() 调用方法

//第二种解构 counterStore  需要使用storeToRefs()
const {count} = storeToRefs(counterStore)
const {add} = counterStore;

</script>

<template>
    <div>
        counterStore.count方式 : {{ counterStore.count }}
        <br>
        <br>
        <button @click="counterStore.add()">counterStore.add</button>
        <br>
        <br>
        count方法: {{ count }}
        <br>
        <br>
        <button @click="add()">add</button>
    </div>
</template>

<style scoped>

</style>
